package com.example.myspring.util;

import java.util.Map;

public class CustomSqlProvider {



    public String countByNameOrPwd(Map<String, Object> params) {
        StringBuilder sql = new StringBuilder("SELECT count(*) FROM student WHERE 1=1");

        if (params.containsKey("name")) {
            sql.append(" AND name = #{name}");
        }

        if (params.containsKey("password")) {
            sql.append(" AND password = MD5(#{password})");
        }

        return sql.toString();
    }
}